
<style media="screen">
  #template-edit{
    margin: 0 24px;
  }
  .tmp-page-title{
    padding: 10px 0;
  }
  .tmp-page-title h3{
    line-height: 34px;
    margin:0;
  }
  .tmp-head-top-wrap{
    padding: 8px 0;
    border-bottom: 1px solid #e5e5e5;
    border-top: 1px solid #e5e5e5;
  }
  .tmp-head-top-wrap .label-title{
    width:100px;
    height: 34px;
    line-height: 34px;
    float: left;
  }
  .tmp-head-top-wrap .ctx{
    float: left;
    width:200px;
  }
  .tmp-head-top-wrap ul.ctx{
    float: left;
    height: 34px;
    line-height: 34px;
    width: 750px;
  }
  .tmp-head-top-wrap ul.ctx li{
    float: left;
    overflow: hidden;
  }
  .tmp-head-top-wrap ul.ctx li span{
    float: left;
    padding-right: 10px;
  }
  .tmp-head-top-wrap ul.ctx li input{
    float: left;
    width: 74px;
    margin-right: 20px;
  }

  #template-edit .title{
    padding: 20px 0;
  }
  #template-edit .box-wrap{
    box-shadow:0 0 8px rgba(0,0,0,.25);
    border-radius: 4px;
    border:1px solid #e5e5e5;
    margin-bottom: 20px;
  }
  .tmp-bill-table-wrap{
    padding: 20px 20px 20px;
    background-color: #fff;
  }
  .tmp-bill-table-opt{
    background-color: #f7f7f7;
    height: 30px;
    line-height:30px;
    text-align: center;
    justify-content: center;
    align-items: center;
    color:#999;
    cursor: pointer;
    margin-bottom: 10px;
    border-radius: 4px;
  }
  .tmp-title-table{

  }
  .tmp-bill-table-title{
    height: 48px;
    line-height: 48px;
    border-bottom: 1px solid #e5e5e5;
  }
  .tmp-bill-table-title th{
    border-right:1px solid #e5e5e5;
    padding: 0px 15px!important;
    white-space: nowrap;
  }
  .tmp-bill-table-title .name{
    color:#a5aab7;
    padding-right: 6px;
  }
  .tmp-bill-table-title .icon{
    cursor: pointer;
  }
  .tmp-bill-table-title li{
    border-right: 1px solid #e5e5e5;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .tmp-bill-table-content{
    text-align: center;
  }
  .tmp-bill-table-content td {
      border-right: 1px solid #e5e5e5;
      padding: 0px 15px!important;
      white-space: nowrap;
  }

    .tmp-footer-btn-wrap{
      margin:10px 0 40px;
    }
    .template-seperate-line{
      height: 1px;
      border-bottom: 1px solid #e5e5e5;
      margin-bottom: 30px;
    }
    .tmp-mes-show ul li{
      float: left;
      width:33%;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 60px;
      border-right: 1px dashed #e5e5e5;
      border-bottom: 1px dashed #e5e5e5;
    }
    .tmp-mes-show ul li:nth-child(3n){
      border-right: none;
    }
    .tmp-ipt-cell{
      width: 180px;
      height: 34px;
      position: relative;
    }
  .tmp-ipt-cell input{
    border-radius: 34px;
  }
    .tmp-ipt-cell .edit-icon{
      position: absolute;
      top:10px;
      right:40px;
      cursor: pointer;
    }
    .tmp-ipt-cell .del-icon{
      position: absolute;
      top:10px;
      right:10px;
      cursor: pointer;
    }

    .tmp-system-content-table .tbs-title li{
      height: 40px;
      line-height: 40px;
      color:#a5aab7;
      text-align: center;
    }
    .tmp-system-content-table .tbs-content li{
      height: 40px;
      line-height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .tmp-system-content-table .tbs-content li.zdy-item{
      overflow: hidden;
    }
    .tmp-system-content-table .tbs-content li.zdy-item div div{
      float: left;
      width: 120px;
      height: 40px;
      line-height: 40px;
      white-space: nowrap;
      overflow: hidden;
    }
    .tmp-system-content-table .tbs-content li.zdy-item div span{
      float: left;
      line-height: 40px;
    }
    .tbs-checkbox-label{
      width: 14px;
      height: 14px;
      line-height: 14px;
      border: 1px solid #c1caca;
      box-shadow: 0 1px 2px rgba(0,0,0,.05), inset 0 -15px 10px -12px rgba(0,0,0,.05);
      border-radius: 4px;
      display: inline-block;
      position: relative;
      cursor: pointer;
      margin-left: 3px;
    }
    .tbs-checkbox-label.active{
      background-color: #5e67a5;
      background-image: url('../../../assets/images/Check.png');
      background-position: center;
      background-repeat: no-repeat;
      background-size: 8px;
    }
    .tbs-checkbox-label input{
      opacity: 0;
      margin:0;
    }
    #template-edit .disabledColor{
      color:#999;
    }

    .tmp-fontSize-wrap{
      width: 400px;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      padding-top: 10px;
      margin: 0 auto;
    }
    .tmp-fontSize-wrap li{
      width:60px;
      line-height: 36px;
      border-radius: 4px;
      border:1px solid #5e67a5;
      color:#5e67a5;
      text-align: center;
      background-color: #fff;
    }
    .tmp-fontSize-wrap li.active{
      background-color:#5e67a5;
      color:#fff;
    }
</style>

<section id="template-edit">
  <div class="tmp-page-title ptb-10 clearfix">
    <h3 class="font-16 pull-left font-nm">打印模版配置</h3>
  </div>

  <div class="tmp-head-top-wrap">
    <div class="clearfix mb-10">
      <div class="label-title">模版名称：</div>
      <div class="ctx">
        <input type="text" class="form-control" v-model="name">
      </div>
    </div>
    <div class="clearfix">
      <div class="label-title">页边距：</div>
      <ul class="ctx">
        <li>
          <span>上</span>
          <input type="number" class="form-control" v-model="pageTop">
        </li>
        <li>
          <span>下</span>
          <input type="number" class="form-control" v-model="pageBottom">
        </li>
        <li>
          <span>左</span>
          <input type="number" class="form-control" v-model="pageLeft">
        </li>
        <li>
          <span>右</span>
          <input type="number" class="form-control"v-model="pageRight">
        </li>
      </ul>
    </div>
  </div>

  <div>
    <div class="title">账单头部：</div>
    <section class="tmp-mes-show box-wrap" v-if="head.length">
      <ul class="clearfix">
        <li v-for="(item,index) in head">
            <div class="tmp-ipt-cell">
              <input type="text" class="form-control " v-model="item.eleDispName" v-if="item.eleType == 'sys' &&  !item.editFlag" disabled @blur="saveHeadName(index)">
              <input type="text" class="form-control " v-model="item.eleDispName" v-if="item.eleType == 'sys' &&   item.editFlag" @blur="saveHeadName(index)">
              <input type="text" class="form-control " v-model="item.eleValue" v-if="item.eleType == 'txt' && !item.editFlag" disabled @blur="saveHeadName(index)">
              <input type="text" class="form-control " v-model="item.eleValue" v-if="item.eleType == 'txt' && item.editFlag" @blur="saveHeadName(index)">
              <span class="edit-icon icon-Gm-edit" v-if="!item.editFlag" @click="editHeadLabelName(index)"></span>
              <span class="del-icon icon-Gm-delete" @click="deleteHeadLabelItem(index)"></span>
            </div>
          </li>
      </ul>
    </section>
    <section class="mb-10">
      <button type="button" class="btn n-btn-default mr-10" @click="addSystemItemBtn('head')">添加系统内容</button>
      <button type="button" class="btn n-btn-default mr-10" @click="addHeadBlockItemBtn">添加占位</button>
      <button type="button" class="btn n-btn-default mr-10" @click="addHeadTextItemBtn">添加文字</button>
      <button type="button" class="btn n-btn-default mr-10" @click="clearHead">清空头部</button>
      <button type="button" class="btn n-btn-default mr-10" @click="addFontSize('head')">调整字体大小</button>
    </section>
  </div>

  <div>
    <div class="title">账单明细：</div>
    <section class="box-wrap tmp-bill-table-wrap">
      <!-- <ul class="dy-flex tmp-bill-table-opt">
        <li :class="{'dy-fx-1':index == 0 ,'dy-fx-2': index !==0 ,'icon-Gm-delete':item.eleShow == 'Y' && index !== 0 , 'icon-Org-account':item.eleShow != 'Y' && index !== 0}" v-for="(item,index) in tbTitle" @click="changeBillTableColumn(item.eleShow,index)"></li>
      </ul> -->
      <div style="overflow:scroll;">
        <table class="tmp-title-table box-wrap">
          <thead>
            <tr class="tmp-bill-table-title">
                <th v-for="(item,index) in tbTitle" class="relative">
                    <div v-if="!item.editFlag">
                        <span class="name" :class="{'disabledColor':item.eleShow != 'Y' }">{{item.eleDispName ? item.eleDispName : item.eleName}}</span>
                        <span class="icon icon-Gm-edit" :class="{'disabledColor':item.eleShow != 'Y' }" @click="editBillName(item.eleShow,index)"></span>
                        <span :class="{'icon-Gm-delete':item.eleShow == 'Y' && index !== 0 , 'icon-Org-account':item.eleShow != 'Y' && index !== 0}" @click="changeBillTableColumn(item.eleShow,index)"></span>
                    </div>
                    <input type="text" class="form-control" v-if="item.editFlag" v-model="item.eleDispName" @blur="saveBillName(index)">
                </th>
            </tr>
          </thead>

          <tbody>
            <tr class="tmp-bill-table-content">
                <td v-for="(item,index) in tbContent">
                    <div :class="{'disabledColor':item.eleShow != 'Y' }">{{item.value}}</div>
                </td>
            </tr>
          </tbody>
        </table>
      </div>
    </section>
  </div>

  <div>
    <div class="title">账单底部：</div>

    <section class="tmp-mes-show box-wrap" v-if="footer.length">
      <ul class="clearfix">
        <li v-for="(item,index) in footer">
            <div class="tmp-ipt-cell">
              <input type="text" class="form-control " v-model="item.eleDispName" v-if="item.eleType == 'sys' &&  !item.editFlag" disabled @blur="saveFooterName(index)">
              <input type="text" class="form-control " v-model="item.eleDispName" v-if="item.eleType == 'sys' &&   item.editFlag" @blur="saveFooterName(index)">
              <input type="text" class="form-control " v-model="item.eleValue" v-if="item.eleType == 'txt' && !item.editFlag" disabled @blur="saveFooterName(index)">
              <input type="text" class="form-control " v-model="item.eleValue" v-if="item.eleType == 'txt' && item.editFlag" @blur="saveFooterName(index)">
              <span class="edit-icon icon-Gm-edit" v-if="!item.editFlag" @click="editFooterLabelName(index)"></span>
              <span class="del-icon icon-Gm-delete" @click="deleteFooterLabelItem(index)"></span>
            </div>
          </li>
      </ul>
    </section>

    <section class="tmp-footer-btn-wrap">
      <button type="button" class="btn n-btn-default mr-10" @click="addSystemItemBtn('footer')">添加系统内容</button>
      <button type="button" class="btn n-btn-default mr-10" @click="addFooterBlockItemBtn">添加占位</button>
      <button type="button" class="btn n-btn-default mr-10" @click="addFooterTextItemBtn">添加文字</button>
      <button type="button" class="btn n-btn-default mr-10" @click="clearFooter">清空底部</button>
      <button type="button" class="btn n-btn-default mr-10" @click="addFontSize('footer')">调整字体大小</button>
    </section>
  </div>

  <div class="template-seperate-line"></div>
  <section class="mb-10">
    <hl-button type="primary"  @on-click="saveTmp">保存</hl-button>
    <hl-button type="outline" @on-click="previewTmp">预览</hl-button>
  </section>

  <!-- 添加系统内容 -->
  <div class="pop box-o-shadow" v-show="isShowSysLayer" style="width:600px;">
    <div class="head-pop font-16"><span>添加系统内容</span>
      <button class="fw-close absolute close" type="button" @click="closeSysLayer">×</button>
    </div>
    <div class="content-pop">
      <div class="content text-center" style="padding:40px 50px;">
        <div class="border box-i-shadow br-4 tmp-system-content-table">
          <ul class="dy-flex tbs-title border-b">
            <li class="dy-fx-1">选择</li>
            <li class="dy-fx-2">名称</li>
            <li class="dy-fx-2">自定义名称</li>
            <li class="dy-fx-2">主键ID</li>
          </ul>
          <ul class="dy-flex tbs-content border-b" v-for="(item,index) in systemContent">
            <li class="dy-fx-1 sel-item"  @click="selectSystemItem(index)">
              <label class="tbs-checkbox-label" :class="{ 'active':item.checked }">
                <input type="checkbox">
              </label>
            </li>
            <li class="dy-fx-2">{{item.eleName}}</li>
            <li class="dy-fx-2 zdy-item" style="padding:4px;">
              <div v-if="!item.zdyNameFlag">
                <div>{{item.zdyName}}</div>
                <span class="icon-Gm-edit cursor" @click="editSystemItemName(index)"></span>
              </div>
              <input type="text" class="form-control" v-if="item.zdyNameFlag" v-model="item.zdyName" @blur="saveSystemItemName(index)">
            </li>
            <li class="dy-fx-2">{{item.templateKey}}</li>
          </ul>
        </div>
      </div>
    </div>
    <div class="fw-button">
      <hl-button type="primary" @on-click="confirmAddSysItem">确认</hl-button>
      <hl-button type="outline" @on-click="closeSysLayer">取消</hl-button>
    </div>
  </div>
  <!-- 添加文字内容 -->
  <div class="pop box-o-shadow" v-show="isShowTxtLayer" style="width:600px;">
    <div class="head-pop font-16"><span>添加文字</span>
      <button class="fw-close absolute close" type="button" @click="closeTxtLayer">×</button>
    </div>
    <div class="content-pop">
      <div class="content text-center" style="padding:40px 50px;">
        <textarea name="name" rows="8" cols="80" v-model="tmpText" class="form-control"></textarea>
      </div>
    </div>
    <div class="fw-button">
      <hl-button type="primary" @on-click="confirmAddTxtItem">确认</hl-button>
      <hl-button type="outline" @on-click="closeTxtLayer">取消</hl-button>
    </div>
  </div>
  <!-- 添加字体大小 -->
  <div class="pop box-o-shadow" v-show="isShowFontLayer" style="width:600px;">
    <div class="head-pop font-16"><span>调整字体大小</span>
      <button class="fw-close absolute close" type="button" @click="closeFontLayer">×</button>
    </div>
    <div class="content-pop">
      <div class="content text-center" style="padding:40px 50px;">
        <div class="select-ul" id="font-st" style="width:400px;">
          <span class="select-name br-4 box-i-shadow">{{fontSizeName}}</span>
          <ul>
            <li v-for="item in fontSizeProList" @click="selectBlockItem(item.eleType,item.eleDispName,item.eleValue)" v-if=" item.eleType == 'txt' " >{{item.eleValue}}</li>
            <li v-for="item in fontSizeProList" @click="selectBlockItem(item.eleType,item.eleDispName,item.eleValue)" v-if=" item.eleType == 'sys' ">{{item.eleDispName}}</li>
          </ul>
        </div>
        <ul class="tmp-fontSize-wrap">
          <li v-for="item in fontSizeList" :class="{'active':item.code == selectedFontSize }" @click="selectFontSize(item.code)">{{item.name}}</li>
        </ul>
      </div>
    </div>
    <div class="fw-button">
      <hl-button type="primary"  @on-click="confirmAddFontItem">确认</hl-button>
      <hl-button type="outline"  @on-click="closeFontLayer">取消</hl-button>
    </div>
  </div>

  <!--遮罩-->
  <div class="backdrop" v-show="isShowSysLayer"></div>
  <div class="backdrop" v-show="isShowTxtLayer"></div>
  <div class="backdrop" v-show="isShowFontLayer"></div>

</section>

<script src="modules/print_template/scripts/bill_tmp_edit.js" charset="utf-8"></script>
